﻿<UserControl xmlns:ParseControls="clr-namespace:ParseControls;assembly=ParseControls"  x:Class="ParseOnlineAdmin.ParseAppsView"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:local="clr-namespace:ParseOnlineAdmin"
			 mc:Ignorable="d" d:DesignHeight="40" d:DesignWidth="300">

	<UserControl.Resources>

		<local:ParseObjectToStringConverter x:Key="valueConverter" />

		<SolidColorBrush x:Key="transp" Color="Transparent"  Opacity="0" />
		<SolidColorBrush x:Key="snow" Color="Transparent" Opacity="0.0001" />
		<SolidColorBrush  x:Key="light"  Color="White" Opacity="0.35" />
		<SolidColorBrush x:Key="over" Color="White"  Opacity="0.50" />
		<SolidColorBrush x:Key="selected"  Color="White"  Opacity="0.75" />

		<!-- FocusVisual -->
		<Style x:Key="SimpleFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Border
						BorderBrush="Transparent"
						BorderThickness="0"
						SnapsToDevicePixels="true">
							<!--
							<Border.Effect>
							<DropShadowEffect ShadowDepth="0"
							Color="Gray"
							BlurRadius="5" />
							</Border.Effect>
						-->
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="listboxitem" TargetType="ListBoxItem">
			<Setter Property="Opacity" Value="0" />
			<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
			<Setter Property="RenderTransform">
				<Setter.Value>
					<TranslateTransform Y="-10" />
				</Setter.Value>
			</Setter>
			<Setter
			Property="FocusVisualStyle"
			Value="{StaticResource SimpleFocusVisual}" />
			<Setter Property="BorderBrush" Value="#fff" />
			<Setter Property="BorderThickness" Value="0,0,0,1" />
			<Setter Property="Foreground" Value="#333" />
			<Setter Property="Background" Value="{StaticResource light}" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="HorizontalAlignment" Value="Stretch" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid Background="{TemplateBinding Background}"
						SnapsToDevicePixels="true">
							<Rectangle x:Name="rectBg"
							SnapsToDevicePixels="true" />
							<Border x:Name="line"
							Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}"
							SnapsToDevicePixels="true" />

							<ContentPresenter Margin="0"
							HorizontalAlignment="Stretch"
							Content="{TemplateBinding Content}"
							ContentTemplate="{TemplateBinding ContentTemplate}"
							SnapsToDevicePixels="true" />
						</Grid>
						<ControlTemplate.Triggers>
							<EventTrigger RoutedEvent="Loaded">
								<BeginStoryboard>
									<Storyboard Storyboard.DesiredFrameRate="30">
										<DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
										Duration="0:0:0.7" From="0"
										Storyboard.TargetProperty="Opacity" To="1" />
										<DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
										Duration="0:0:0.7" From="-10"
										Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)"
										To="0" />
									</Storyboard>
								</BeginStoryboard>
							</EventTrigger>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="Fill" TargetName="rectBg" Value="#007ACC" />
								<Setter Property="TextBlock.Foreground" Value="#fff" />
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="False" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="BorderThickness" TargetName="line" Value="0,0,0,1" />
								<Setter Property="BorderBrush" TargetName="line" Value="#007ACC" />
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Fill" TargetName="rectBg" Value="#fff" />
								<Setter Property="Opacity" TargetName="rectBg" Value="0.5" />
							</MultiTrigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="True" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
							</MultiTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Background" Value="Silver" />
					<Setter Property="Foreground" Value="White" />
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="listbox" TargetType="{x:Type ListBox}">
			<Setter  Property="BorderThickness"  Value="0" />
			<Setter  Property="Margin"  Value="0" />
			<Setter  Property="Padding"  Value="0" />
			<Setter Property="Background"  Value="{StaticResource snow}" />
		</Style>
		<Style x:Key="textbox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="{StaticResource light}" />
			<Setter Property="BorderThickness" Value="0" />
			<Setter Property="Padding" Value="3" />
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="true">
					<Setter Property="Background" Value="{StaticResource over}" />
					<Setter  Property="BorderThickness"  Value="0" />
				</Trigger>
				<Trigger  Property="IsFocused" Value="true">
					<Setter  Property="Background" Value="{StaticResource selected}" />
					<Setter  Property="BorderThickness" Value="0" />
				</Trigger>
			</Style.Triggers>
		</Style>
	</UserControl.Resources>
	
	<Border x:Name="line" Opacity="0.5" SnapsToDevicePixels="True" 
								Padding="0,5,0,0"   BorderThickness="0,0,0,1">
		<Border.BorderBrush>
			<VisualBrush>
				<VisualBrush.Visual>
					<Rectangle Stroke="#999" 
													   StrokeDashArray="4 2" StrokeThickness="1"
												SnapsToDevicePixels="True" 
										Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
										Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
				</VisualBrush.Visual>
			</VisualBrush>
		</Border.BorderBrush>

		<Grid>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="Auto"/>
			</Grid.ColumnDefinitions>

			<ParseControls:FwComboBox Margin="5" Grid.Column="0" 
						ItemsSource="{Binding Path=AppItems, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
									ScrollViewer.HorizontalScrollBarVisibility="Hidden"
									ScrollViewer.VerticalScrollBarVisibility="Auto"
									SelectedItem="{Binding Path=SelectedApp, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}">
				<ParseControls:FwComboBox.ItemTemplate>
					<DataTemplate>
						<Grid>
                            <TextBlock Text="{Binding Path=Name}" Margin="5" />
						</Grid>
					</DataTemplate>
				</ParseControls:FwComboBox.ItemTemplate>
			</ParseControls:FwComboBox>

			<ParseControls:FwButton  Margin="3" Height="30" Width="30" Grid.Column="1" Click="Button_Click" 
								  SnapsToDevicePixels="True">
				<ParseControls:FwButton.Content>
					<Viewbox>
						<Canvas Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0" Margin="-15" SnapsToDevicePixels="True">
							<Path Width="37.6263" Height="37.6262" Canvas.Left="19.1869" Canvas.Top="19.1868"  SnapsToDevicePixels="True"
							  Stretch="Fill" Fill="#FFffffff" Data="F1 M 27.5314,21.8628L 33.0126,19.4224L 34.7616,23.3507C 36.6693,22.9269 38.6044,22.8903 40.4668,23.2026L 42.0083,19.1868L 47.6098,21.337L 46.0683,25.3528C 47.6612,26.3669 49.0747,27.6889 50.2088,29.2803L 54.1371,27.5313L 56.5776,33.0126L 52.6493,34.7616C 53.0731,36.6693 53.1097,38.6043 52.7974,40.4668L 56.8131,42.0083L 54.6629,47.6097L 50.6472,46.0683C 49.6331,47.6613 48.3111,49.0748 46.7197,50.2089L 48.4686,54.1372L 42.9874,56.5776L 41.2384,52.6493C 39.3307,53.0731 37.3957,53.1097 35.5333,52.7974L 33.9918,56.8131L 28.3903,54.6629L 29.9318,50.6472C 28.3388,49.6331 26.9252,48.3111 25.7911,46.7196L 21.8628,48.4686L 19.4224,42.9873L 23.3507,41.2383C 22.9269,39.3307 22.8903,37.3957 23.2026,35.5332L 19.1869,33.9918L 21.3371,28.3903L 25.3528,29.9318C 26.3669,28.3388 27.6889,26.9252 29.2804,25.7911L 27.5314,21.8628 Z M 34.3394,29.7781C 29.7985,31.7998 27.7564,37.1198 29.7781,41.6606C 31.7998,46.2015 37.1198,48.2436 41.6606,46.2219C 46.2015,44.2002 48.2436,38.8802 46.2219,34.3394C 44.2002,29.7985 38.8802,27.7564 34.3394,29.7781 Z "/>
						</Canvas>
					</Viewbox>
				</ParseControls:FwButton.Content>
			</ParseControls:FwButton>

		</Grid>
	</Border>
</UserControl>
